<?php
namespace app\common\controller;

/**
 * 计算用户积分类
 * Created by PhpStorm.
 * User: tyll
 * Date: 2019/11/27
 * Time: 11:18
 */
class CountUserIntegral {

    /**
     * 计算总积分
     * @param $openid
     * @return mixed
     */
    public function count_user_integral($openid){
        //计算总积分
        $maps = [];
        $maps[] = ['openid','=',$openid];
        $total_integral = model('integral_record')->get_sum($maps,'integral');

        $data['total_integral'] = $total_integral;
        return $data;
    }
}